package HomeworkDay2;

public class Homework7PrimeAndPalindrome {
	public static void main(String[] args){
		int num=1,x,cishu=0;
		System.out.print("\n");
		for(int i=0;i<9;i++){
			num=i;
			for(x=2;x<num;x++){
				 if(num%x==0){
					 break;
		         }
			 }
			 if(x>=num&&num!=0){
				 System.out.print(num+" ");
				 cishu++;
				 if(cishu==10){
					 System.out.print("\n");
				 }
			 }  
		}
		for(int i=0;i<9;i++){
			num=i*10+i;
			for(x=2;x<num;x++){
				 if(num%x==0){
					 break;
		         }
			 }
			 if(x>=num&&num!=0){
				 System.out.print(num+" ");
				 cishu++;
				 if(cishu==10){
					 System.out.print("\n");
				 }
			 }  
		}
		for(int a=0;a<9;a++){
			for(int b=0;b<9;b++){
				num=a*100+b*10+a;
				 for(x=2;x<num;x++){
					 if(num%x==0){
						 break;
			         }
				 }
				 if(x>=num&&num!=0){
					 System.out.print(num+" ");
					 cishu++;
					 if(cishu==10){
						 System.out.print("\n");
					 }
				 }  
			}
		}
	}

}
